/****************************************************************************
 * 
 * Copyright (c) 2008 Nuvoton Technology Corp. All rights reserved. 
 *
 ****************************************************************************/
 
/****************************************************************************
 * 
 * FILENAME
 *     spi.h
 *
 *************************************************************************/

#ifndef __SPI_H_
#define __SPI_H_

#include <linux/types.h>

#include <sys/stat.h>


#define REAL_BOARD


typedef struct Flr_Map{
	char flr0[4];
	char flr1[4];
}Flr_Map;

typedef struct flr{
	char flr1;
	char flr2;
	char flr3;
}flr;

typedef struct LIFT_WORK_INFO{
	char run_dir;
	char floor_num[3];
	char work_status;
	char door_status;
}LIFT_WORK_INFO;

struct spi_parameter{
	unsigned int active_level:1;
	unsigned int lsb:1, tx_neg:1, rx_neg:1, divider:16;
	unsigned int sleep:4;
};

struct spi_data{
	unsigned int write_data;
	unsigned int read_data;
	unsigned int bit_len;
};

struct spi_buffer
{
	unsigned int tx_buffer[256];
	unsigned int tx_length;
};

extern _enum_DMODE G_DispMode;

#define SPI_MAJOR		231

#define SPI_IOC_MAGIC			'u'
#define SPI_IOC_MAXNR			5

#define SPI_IOC_GETPARAMETER	_IOR(SPI_IOC_MAGIC, 0, struct usi_parameter *)
#define SPI_IOC_SETPARAMETER	_IOW(SPI_IOC_MAGIC, 1, struct usi_parameter *)
#define SPI_IOC_SELECTSLAVE 	_IOW(SPI_IOC_MAGIC, 2, int)
#define SPI_IOC_TRANSIT		_IOW(SPI_IOC_MAGIC, 3, struct usi_data *)
#define SPI_IOC_TRANSITBUF	_IOW(SPI_IOC_MAGIC, 4, struct usi_buffer *)
#define SPI_IOC_GETSTATUS   _IOW(SPI_IOC_MAGIC, 5, int *)

#endif /* _SPI_H_ */

